/**
 * Created by fcs on 2014/11/19.
 */
function createDynamicDiv(){
    var div1=$('<div id="p7"></div>');
    div1.css({"height":100,"width":100,"margin-left":100});
    var i = parseInt(Math.random()*5);
    //红黄蓝绿黑
    if( i == 0){
        $("#p7").css({"background-color":"red"});
    }else if(i == 1){
        $("#p7").css({"background-color":"yellow"});
    }else if(i ==2){
        $("#p7").css({"background-color":"blue"});
    }else if(i ==3){
        $("#p7").css({"background-color":"green"});
    }else {
        $("#p7").css({"background-color":"black"});
    }
    div1.appendTo("body");
}
/*代码优化版本*/
function createDynamicDiv1(){
    $('<div id="pmx"></div>').css({"height":100,"width":100}).appendTo("body");
    var i = parseInt(Math.random()*5);
    var colorArray = new Array(5);
    colorArray  = ["red","yellow","blue","green","black"];
    document.getElementById('pmx').style.backgroundColor=colorArray[i];
}
